<template>
   <div class="topbar">
         <span class="iconfont icon-jiantou2" @click="goback()"></span>
          <span class="rose" v-for="(v,i) in arr" :key="i">{{v.type}}</span>
          <span class="iconfont icon-fenxiang1"  @click="showShare = true"></span>

          <van-share-sheet
  v-model="showShare"
  title="分享到"
  :options="options"
  @select="onSelect"
/>
</div>
</template>

<script>
import { Toast } from 'vant';
import {getlink} from '@/api/getapi.js'
export default {
    data() {
    return {
      showShare: false,
      options: [
        { name: '微信', icon: 'wechat' },
        { name: '微博', icon: 'weibo' },
        { name: '复制链接', icon: 'link' },
        { name: '分享海报', icon: 'poster' },
        { name: '二维码', icon: 'qrcode' },
      ],
       arr:[]
    };
  },
  created() {
    getlink("/demo/flowertype")
      .then((ok) => {
        ok.data.flowertype.forEach((v) => {
          if (v.typeid == this.$route.query.typeid) {
            this.arr.push(v);
          }
        });
      });
  },
methods:{
      onSelect(option) {
      Toast(option.name);
      this.showShare = false;
    },
    goback(){
        this.$router.push("/flower")
    }
}
}
</script>

<style scoped>
@import '../../../public/flower/iconfont.css';
.topbar{  
  width: 100%; 
    display: flex;
   justify-content: space-between;
  height:0.8rem;
  line-height: 0.8rem;
  padding: 0 0.14rem;
  box-sizing: border-box;
  position: fixed;
  top: 0;
  background-color: #fff;
  z-index: 333;
}
.iconfont{
    font-size: 0.2rem;  
    color: #d3792e;
}
.rose{
  font-size: 0.18rem;
}
</style>